Skip to content

Export public sorting APIs to /sorter#438

Merged
Boshen merged 15 commits intotailwindlabs:mainfrom
Dunqing:feat/public-api
Feb 5, 2026
Merged

Export public sorting APIs to /sorter#438
Boshen merged 15 commits intotailwindlabs:mainfrom
Dunqing:feat/public-api

Conversation

@Dunqing
Copy link
Contributor

@Dunqing Dunqing commented Feb 4, 2026

Continue work on https://github.com/tailwindlabs/prettier-plugin-tailwindcss/tree/feat/public-api

close: #430

Some differences from #430

  1. Export sorting APIs to /sorter, which is a more descriptive entry point
  2. Removed formatterConfigPath, I found this is useless, it is only used to log a warning, I think log base is okay.
  3. Minor API modification

Extra Optimization

843a4dc made an optimization to avoid unnecessary resolution of the Prettier configuration, which is quite expensive!

I think the following dub benchmark is at least half as fast due to this optimization because this repo has no Tailwind configuration set.

Benchmark

Note: new means the current branch, old means the latest package in npm, so it includes a few optimizations that have already been merged into the main branch, not all in this branch.

Benchmark repo: https://github.com/dubinc/dub

Benchmark 1: prettier-tailwindcss-new
  Time (mean ± σ):      8.038 s ±  0.216 s    [User: 12.546 s, System: 0.836 s]
  Range (min … max):    7.886 s …  8.191 s    2 runs
 
Benchmark 2: prettier-tailwindcss-old
  Time (mean ± σ):     11.923 s ±  0.060 s    [User: 14.954 s, System: 2.520 s]
  Range (min … max):   11.881 s … 11.966 s    2 runs
 
Benchmark 3: oxfmt-new
  Time (mean ± σ):     999.8 ms ±  32.1 ms    [User: 8968.9 ms, System: 2246.7 ms]
  Range (min … max):   977.2 ms … 1022.5 ms    2 runs
 
Benchmark 4: oxfmt-old
  Time (mean ± σ):      1.628 s ±  0.027 s    [User: 13.239 s, System: 4.980 s]
  Range (min … max):    1.609 s …  1.647 s    2 runs
 
Summary
  oxfmt-new ran
    1.63 ± 0.06 times faster than oxfmt-old
    8.04 ± 0.34 times faster than prettier-tailwindcss-new
   11.93 ± 0.39 times faster than prettier-tailwindcss-old

Benchmark repo: https://github.com/tailwindcsslab/headlessui

Benchmark 1: prettier-tailwindcss-new
  Time (mean ± σ):      3.588 s ±  0.056 s    [User: 6.432 s, System: 0.361 s]
  Range (min … max):    3.551 s …  3.670 s    4 runs
 
Benchmark 2: prettier-tailwindcss-old
  Time (mean ± σ):      4.134 s ±  0.108 s    [User: 6.919 s, System: 0.611 s]
  Range (min … max):    4.030 s …  4.246 s    4 runs
 
Benchmark 3: oxfmt-new
  Time (mean ± σ):     778.8 ms ±  28.9 ms    [User: 7633.6 ms, System: 912.9 ms]
  Range (min … max):   738.3 ms … 806.9 ms    4 runs
 
Benchmark 4: oxfmt-old
  Time (mean ± σ):      1.033 s ±  0.034 s    [User: 10.048 s, System: 1.454 s]
  Range (min … max):    0.994 s …  1.073 s    4 runs
 
Summary
  oxfmt-new ran
    1.33 ± 0.07 times faster than oxfmt-old
    5.61 ± 0.19 times faster than prettier-tailwindcss-new
    6.31 ± 0.24 times faster than prettier-tailwindcss-old

@Boshen Boshen changed the title Export public sorting APIs to /lib Export public sorting APIs to /sorter Feb 5, 2026
@Dunqing Dunqing marked this pull request as ready for review February 5, 2026 08:58
@Boshen Boshen merged commit ecdf567 into tailwindlabs:main Feb 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export getTailwindConfig and sortClasses for Oxfmt formatter integration

3 participants